package com.yanmaohu.nikita.data;

import com.yanmaohu.nikita.data.expression.NameExpression;

/**
 * @author Bright Lee
 */
public abstract class Type {

    private final TypeModifier typeModifier;
    private final NameExpression typeName;

    protected Type(TypeModifier typeModifier, NameExpression typeName) {
        this.typeModifier = typeModifier;
        this.typeName = typeName;
    }

    public final int getBeginIndex() {
        if (typeModifier != null) {
            return typeModifier.getBeginIndex();
        }
        return typeName.getBeginIndex();
    }

    public abstract int getEndIndex();

    public final TypeModifier getTypeModifier() {
        return typeModifier;
    }

    public final NameExpression getTypeName() {
        return typeName;
    }

}
